package com.yita.demo01_base;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Demo01_Connection {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // 1.加载驱动程序
        Class.forName("com.mysql.cj.jdbc.Driver");

        String url = "jdbc:mysql://localhost:13306/fruitdb";
        String user = "root";
        String pwd = "root";
        //2.获取数据库连接
        Connection conn = DriverManager.getConnection(url,user,pwd);
        System.out.println(conn);

        conn.close();

    }

}
